gtk/gtkaccelmap.[ch] gtk/gtkfilechooser.[ch] gtk/gtkfilesel.c
authorTor Lillqvist <tml@iki.fi>
Sun, 12 Dec 2004 21:09:13 +0000 (21:09 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sun, 12 Dec 2004 21:09:13 +0000 (21:09 +0000)
2004-12-12  Tor Lillqvist  <tml@iki.fi>

* gtk/gtkaccelmap.[ch]
* gtk/gtkfilechooser.[ch]
* gtk/gtkfilesel.c
* gtk/gtkfilesystemwin32.c
* gtk/gtkiconfactory.[ch]
* gtk/gtkicontheme.[ch]
* gtk/gtkimage.[ch]
* gtk/gtkimmodule.c
* gtk/gtkmodules.c
* gtk/gtkrc.[ch]
* gtk/gtkuimanager.[ch]
* gtk/gtkwindow.[ch]
* gtk/updateiconcache.c
* gtk/gtk.symbols: Use gstdio wrappers. On Windows, convert
environment variables referring to pathnames from locale encoding
to UTF-8. As in GLib, in order to preserve Windows DLL ABI
stability, add binary compatibility versions of functions that
take file names as arguments, or return file names. Add a _utf8
suffix to the "real" such functions on Windows. The ABI
compatibility versions keep the old name.

* gtk/Makefile.am: Strip PRIVATE symbols from the GNU import
library.

* gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Implement
file mapping on Win32.

* gtk/updateiconcache.c: Don't crash if invoked without
argument. Use binary mode when opening file.

* modules/engines/ms-windows/Theme/gtk-2.0/Makefile.am: Install
gtkrc in correct place, in <datadir>/themes/MS-Windows/gtk-2.0.

30 files changed:
ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/Makefile.am
gtk/gtk.symbols
gtk/gtkaccelmap.c
gtk/gtkaccelmap.h
gtk/gtkfilechooser.c
gtk/gtkfilechooser.h
gtk/gtkfilesel.c
gtk/gtkfilesel.h
gtk/gtkfilesystemwin32.c
gtk/gtkiconcache.c
gtk/gtkiconfactory.c
gtk/gtkiconfactory.h
gtk/gtkicontheme.c
gtk/gtkicontheme.h
gtk/gtkimage.c
gtk/gtkimage.h
gtk/gtkimmodule.c
gtk/gtkmodules.c
gtk/gtkrc.c
gtk/gtkrc.h
gtk/gtkuimanager.c
gtk/gtkuimanager.h
gtk/gtkwindow.c
gtk/gtkwindow.h
gtk/updateiconcache.c
modules/engines/ms-windows/Theme/gtk-2.0/Makefile.am

index f28efb01ccd37151e75456a478bafcc3b9d3ee3a..f2b8fa4e32ec700a7a7085a91b19f11c597023d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2004-12-11  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkaccelmap.[ch]
+       * gtk/gtkfilechooser.[ch]
+       * gtk/gtkfilesel.c
+       * gtk/gtkfilesystemwin32.c
+       * gtk/gtkiconfactory.[ch]
+       * gtk/gtkicontheme.[ch]
+       * gtk/gtkimage.[ch]
+       * gtk/gtkimmodule.c
+       * gtk/gtkmodules.c
+       * gtk/gtkrc.[ch]
+       * gtk/gtkuimanager.[ch]
+       * gtk/gtkwindow.[ch]    
+       * gtk/updateiconcache.c
+       * gtk/gtk.symbols: Use gstdio wrappers. On Windows, convert
+       environment variables referring to pathnames from locale encoding
+       to UTF-8. As in GLib, in order to preserve Windows DLL ABI
+       stability, add binary compatibility versions of functions that
+       take file names as arguments, or return file names. Add a _utf8
+       suffix to the "real" such functions on Windows. The ABI
+       compatibility versions keep the old name.
+
+       * gtk/Makefile.am: Strip PRIVATE symbols from the GNU import
+       library.
+
+       * gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Implement
+       file mapping on Win32.
+
+       * gtk/updateiconcache.c: Don't crash if invoked without
+       argument. Use binary mode when opening file.
+
+       * modules/engines/ms-windows/Theme/gtk-2.0/Makefile.am: Install
+       gtkrc in correct place, in <datadir>/themes/MS-Windows/gtk-2.0.
+
 2004-12-12  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtklabel.c (gtk_label_setup_mnemonic): Fix a 
index f28efb01ccd37151e75456a478bafcc3b9d3ee3a..f2b8fa4e32ec700a7a7085a91b19f11c597023d0 100644 (file)
@@ -1,3 +1,38 @@
+2004-12-11  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkaccelmap.[ch]
+       * gtk/gtkfilechooser.[ch]
+       * gtk/gtkfilesel.c
+       * gtk/gtkfilesystemwin32.c
+       * gtk/gtkiconfactory.[ch]
+       * gtk/gtkicontheme.[ch]
+       * gtk/gtkimage.[ch]
+       * gtk/gtkimmodule.c
+       * gtk/gtkmodules.c
+       * gtk/gtkrc.[ch]
+       * gtk/gtkuimanager.[ch]
+       * gtk/gtkwindow.[ch]    
+       * gtk/updateiconcache.c
+       * gtk/gtk.symbols: Use gstdio wrappers. On Windows, convert
+       environment variables referring to pathnames from locale encoding
+       to UTF-8. As in GLib, in order to preserve Windows DLL ABI
+       stability, add binary compatibility versions of functions that
+       take file names as arguments, or return file names. Add a _utf8
+       suffix to the "real" such functions on Windows. The ABI
+       compatibility versions keep the old name.
+
+       * gtk/Makefile.am: Strip PRIVATE symbols from the GNU import
+       library.
+
+       * gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Implement
+       file mapping on Win32.
+
+       * gtk/updateiconcache.c: Don't crash if invoked without
+       argument. Use binary mode when opening file.
+
+       * modules/engines/ms-windows/Theme/gtk-2.0/Makefile.am: Install
+       gtkrc in correct place, in <datadir>/themes/MS-Windows/gtk-2.0.
+
 2004-12-12  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtklabel.c (gtk_label_setup_mnemonic): Fix a 
index f28efb01ccd37151e75456a478bafcc3b9d3ee3a..f2b8fa4e32ec700a7a7085a91b19f11c597023d0 100644 (file)
@@ -1,3 +1,38 @@
+2004-12-11  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkaccelmap.[ch]
+       * gtk/gtkfilechooser.[ch]
+       * gtk/gtkfilesel.c
+       * gtk/gtkfilesystemwin32.c
+       * gtk/gtkiconfactory.[ch]
+       * gtk/gtkicontheme.[ch]
+       * gtk/gtkimage.[ch]
+       * gtk/gtkimmodule.c
+       * gtk/gtkmodules.c
+       * gtk/gtkrc.[ch]
+       * gtk/gtkuimanager.[ch]
+       * gtk/gtkwindow.[ch]    
+       * gtk/updateiconcache.c
+       * gtk/gtk.symbols: Use gstdio wrappers. On Windows, convert
+       environment variables referring to pathnames from locale encoding
+       to UTF-8. As in GLib, in order to preserve Windows DLL ABI
+       stability, add binary compatibility versions of functions that
+       take file names as arguments, or return file names. Add a _utf8
+       suffix to the "real" such functions on Windows. The ABI
+       compatibility versions keep the old name.
+
+       * gtk/Makefile.am: Strip PRIVATE symbols from the GNU import
+       library.
+
+       * gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Implement
+       file mapping on Win32.
+
+       * gtk/updateiconcache.c: Don't crash if invoked without
+       argument. Use binary mode when opening file.
+
+       * modules/engines/ms-windows/Theme/gtk-2.0/Makefile.am: Install
+       gtkrc in correct place, in <datadir>/themes/MS-Windows/gtk-2.0.
+
 2004-12-12  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtklabel.c (gtk_label_setup_mnemonic): Fix a 
index f28efb01ccd37151e75456a478bafcc3b9d3ee3a..f2b8fa4e32ec700a7a7085a91b19f11c597023d0 100644 (file)
@@ -1,3 +1,38 @@
+2004-12-11  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkaccelmap.[ch]
+       * gtk/gtkfilechooser.[ch]
+       * gtk/gtkfilesel.c
+       * gtk/gtkfilesystemwin32.c
+       * gtk/gtkiconfactory.[ch]
+       * gtk/gtkicontheme.[ch]
+       * gtk/gtkimage.[ch]
+       * gtk/gtkimmodule.c
+       * gtk/gtkmodules.c
+       * gtk/gtkrc.[ch]
+       * gtk/gtkuimanager.[ch]
+       * gtk/gtkwindow.[ch]    
+       * gtk/updateiconcache.c
+       * gtk/gtk.symbols: Use gstdio wrappers. On Windows, convert
+       environment variables referring to pathnames from locale encoding
+       to UTF-8. As in GLib, in order to preserve Windows DLL ABI
+       stability, add binary compatibility versions of functions that
+       take file names as arguments, or return file names. Add a _utf8
+       suffix to the "real" such functions on Windows. The ABI
+       compatibility versions keep the old name.
+
+       * gtk/Makefile.am: Strip PRIVATE symbols from the GNU import
+       library.
+
+       * gtk/gtkiconcache.c (_gtk_icon_cache_new_for_path): Implement
+       file mapping on Win32.
+
+       * gtk/updateiconcache.c: Don't crash if invoked without
+       argument. Use binary mode when opening file.
+
+       * modules/engines/ms-windows/Theme/gtk-2.0/Makefile.am: Install
+       gtkrc in correct place, in <datadir>/themes/MS-Windows/gtk-2.0.
+
 2004-12-12  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtklabel.c (gtk_label_setup_mnemonic): Fix a 
index d4fdb05332c0a6d756c0cb522a7bd06d16470f44..6cb2e7108f8be4a4b5d0c39d8dddaca103c883d9 100644 (file)
@@ -46,6 +46,10 @@ gtk-win32res.lo : gtk-win32.rc
        $(top_srcdir)/build/win32/lt-compile-resource gtk-win32.rc gtk-win32res.lo
 
 install-libtool-import-lib:
+       for entry in `grep PRIVATE gtk.def | sed -e 's/PRIVATE//'`; do \
+         file=`nm -A .libs/libgtk-win32-$(GTK_API_VERSION).dll.a | tr -d '\r' | grep -m 1 -E $$entry'$$' | cut -d: -f2`; \
+         ar d .libs/libgtk-win32-$(GTK_API_VERSION).dll.a $$file; \
+       done
        $(INSTALL) .libs/libgtk-win32-$(GTK_API_VERSION).dll.a $(DESTDIR)$(libdir)
 uninstall-libtool-import-lib:
        -rm $(DESTDIR)$(libdir)/libtk-win32-$(GTK_API_VERSION).dll.a
index 11b5c42fe37a6f499f40e2dee9794a8cfd036a1b..da2c2d44c468d1c951f16e27a611c17039da673d 100644 (file)
@@ -72,12 +72,18 @@ gtk_accel_map_foreach
 gtk_accel_map_foreach_unfiltered
 gtk_accel_map_get
 gtk_accel_map_get_type G_GNUC_CONST
-gtk_accel_map_load
+gtk_accel_map_load PRIVATE
+#ifdef G_OS_WIN32
+gtk_accel_map_load_utf8
+#endif
 gtk_accel_map_load_fd
 gtk_accel_map_load_scanner
 gtk_accel_map_lock_path
 gtk_accel_map_lookup_entry
-gtk_accel_map_save
+gtk_accel_map_save PRIVATE
+#ifdef G_OS_WIN32
+gtk_accel_map_save_utf8
+#endif
 gtk_accel_map_save_fd
 gtk_accel_map_unlock_path
 gtk_accessible_connect_widget_destroyed
@@ -772,7 +778,10 @@ gtk_expander_style_get_type G_GNUC_CONST
 gtk_false G_GNUC_CONST
 gtk_file_chooser_action_get_type G_GNUC_CONST
 gtk_file_chooser_add_filter
-gtk_file_chooser_add_shortcut_folder
+gtk_file_chooser_add_shortcut_folder PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_add_shortcut_folder_utf8
+#endif
 gtk_file_chooser_add_shortcut_folder_uri
 gtk_file_chooser_button_get_title
 gtk_file_chooser_button_get_type G_GNUC_CONST
@@ -788,14 +797,26 @@ gtk_file_chooser_dialog_new_with_backend
 gtk_file_chooser_error_get_type
 gtk_file_chooser_error_quark
 gtk_file_chooser_get_action
-gtk_file_chooser_get_current_folder
+gtk_file_chooser_get_current_folder PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_get_current_folder_utf8
+#endif
 gtk_file_chooser_get_current_folder_uri
 gtk_file_chooser_get_extra_widget
-gtk_file_chooser_get_filename
-gtk_file_chooser_get_filenames
+gtk_file_chooser_get_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_get_filename_utf8
+#endif
+gtk_file_chooser_get_filenames PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_get_filenames_utf8
+#endif
 gtk_file_chooser_get_filter
 gtk_file_chooser_get_local_only
-gtk_file_chooser_get_preview_filename
+gtk_file_chooser_get_preview_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_get_preview_filename_utf8
+#endif
 gtk_file_chooser_get_preview_uri
 gtk_file_chooser_get_preview_widget
 gtk_file_chooser_get_preview_widget_active
@@ -806,20 +827,35 @@ gtk_file_chooser_get_uri
 gtk_file_chooser_get_uris
 gtk_file_chooser_get_use_preview_label
 gtk_file_chooser_list_filters
-gtk_file_chooser_list_shortcut_folders
+gtk_file_chooser_list_shortcut_folders PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_list_shortcut_folders_utf8
+#endif
 gtk_file_chooser_list_shortcut_folder_uris
 gtk_file_chooser_remove_filter
-gtk_file_chooser_remove_shortcut_folder
+gtk_file_chooser_remove_shortcut_folder PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_remove_shortcut_folder_utf8
+#endif
 gtk_file_chooser_remove_shortcut_folder_uri
 gtk_file_chooser_select_all
-gtk_file_chooser_select_filename
+gtk_file_chooser_select_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_select_filename_utf8
+#endif
 gtk_file_chooser_select_uri
 gtk_file_chooser_set_action
-gtk_file_chooser_set_current_folder
+gtk_file_chooser_set_current_folder PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_set_current_folder_utf8
+#endif
 gtk_file_chooser_set_current_folder_uri
 gtk_file_chooser_set_current_name
 gtk_file_chooser_set_extra_widget
-gtk_file_chooser_set_filename
+gtk_file_chooser_set_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_set_filename_utf8
+#endif
 gtk_file_chooser_set_filter
 gtk_file_chooser_set_local_only
 gtk_file_chooser_set_preview_widget
@@ -829,7 +865,10 @@ gtk_file_chooser_set_show_hidden
 gtk_file_chooser_set_uri
 gtk_file_chooser_set_use_preview_label
 gtk_file_chooser_unselect_all
-gtk_file_chooser_unselect_filename
+gtk_file_chooser_unselect_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_chooser_unselect_filename_utf8
+#endif
 gtk_file_chooser_unselect_uri
 gtk_file_chooser_widget_get_type G_GNUC_CONST
 gtk_file_chooser_widget_new
@@ -871,13 +910,22 @@ gtk_file_paths_copy
 gtk_file_paths_free
 gtk_file_paths_sort
 gtk_file_selection_complete
-gtk_file_selection_get_filename
-gtk_file_selection_get_selections
+gtk_file_selection_get_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_selection_get_filename_utf8
+#endif
+gtk_file_selection_get_selections PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_selection_get_selections_utf8
+#endif
 gtk_file_selection_get_select_multiple
 gtk_file_selection_get_type G_GNUC_CONST
 gtk_file_selection_hide_fileop_buttons
 gtk_file_selection_new
-gtk_file_selection_set_filename
+gtk_file_selection_set_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_file_selection_set_filename_utf8
+#endif
 gtk_file_selection_set_select_multiple
 gtk_file_selection_show_fileop_buttons
 gtk_file_system_create_folder
@@ -1019,7 +1067,10 @@ gtk_icon_info_get_base_size
 gtk_icon_info_get_builtin_pixbuf
 gtk_icon_info_get_display_name
 gtk_icon_info_get_embedded_rect
-gtk_icon_info_get_filename
+gtk_icon_info_get_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_icon_info_get_filename_utf8
+#endif
 gtk_icon_info_get_type G_GNUC_CONST
 gtk_icon_info_load_icon
 gtk_icon_info_set_raw_coordinates
@@ -1044,7 +1095,10 @@ gtk_icon_source_copy
 gtk_icon_source_free
 gtk_icon_source_get_direction
 gtk_icon_source_get_direction_wildcarded
-gtk_icon_source_get_filename
+gtk_icon_source_get_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_icon_source_get_filename_utf8
+#endif
 gtk_icon_source_get_icon_name
 gtk_icon_source_get_pixbuf
 gtk_icon_source_get_size
@@ -1055,7 +1109,10 @@ gtk_icon_source_get_type G_GNUC_CONST
 gtk_icon_source_new
 gtk_icon_source_set_direction
 gtk_icon_source_set_direction_wildcarded
-gtk_icon_source_set_filename
+gtk_icon_source_set_filename PRIVATE
+#ifdef G_OS_WIN32
+gtk_icon_source_set_filename_utf8
+#endif
 gtk_icon_source_set_icon_name
 gtk_icon_source_set_pixbuf
 gtk_icon_source_set_size
@@ -1063,25 +1120,37 @@ gtk_icon_source_set_size_wildcarded
 gtk_icon_source_set_state
 gtk_icon_source_set_state_wildcarded
 gtk_icon_theme_add_builtin_icon
-gtk_icon_theme_append_search_path
+gtk_icon_theme_append_search_path PRIVATE
+#ifdef G_OS_WIN32
+gtk_icon_theme_append_search_path_utf8
+#endif
 gtk_icon_theme_error_get_type
 gtk_icon_theme_error_quark
 gtk_icon_theme_get_default
 gtk_icon_theme_get_example_icon_name
 gtk_icon_theme_get_for_screen
 gtk_icon_theme_get_icon_sizes
-gtk_icon_theme_get_search_path
+gtk_icon_theme_get_search_path PRIVATE
+#ifdef G_OS_WIN32
+gtk_icon_theme_get_search_path_utf8
+#endif
 gtk_icon_theme_get_type G_GNUC_CONST
 gtk_icon_theme_has_icon
 gtk_icon_theme_list_icons
 gtk_icon_theme_load_icon
 gtk_icon_theme_lookup_icon
 gtk_icon_theme_new
-gtk_icon_theme_prepend_search_path
+gtk_icon_theme_prepend_search_path PRIVATE
+#ifdef G_OS_WIN32
+gtk_icon_theme_prepend_search_path_utf8
+#endif
 gtk_icon_theme_rescan_if_needed
 gtk_icon_theme_set_custom_theme
 gtk_icon_theme_set_screen
-gtk_icon_theme_set_search_path
+gtk_icon_theme_set_search_path PRIVATE
+#ifdef G_OS_WIN32
+gtk_icon_theme_set_search_path_utf8
+#endif
 gtk_icon_view_get_markup_column
 gtk_icon_view_get_model
 gtk_icon_view_get_orientation
@@ -1132,7 +1201,10 @@ gtk_image_menu_item_new_with_mnemonic
 gtk_image_menu_item_set_image
 gtk_image_new
 gtk_image_new_from_animation
-gtk_image_new_from_file
+gtk_image_new_from_file PRIVATE
+#ifdef G_OS_WIN32
+gtk_image_new_from_file_utf8
+#endif
 gtk_image_new_from_icon_name
 gtk_image_new_from_icon_set
 gtk_image_new_from_image
@@ -1141,7 +1213,10 @@ gtk_image_new_from_pixmap
 gtk_image_new_from_stock
 gtk_image_set
 gtk_image_set_from_animation
-gtk_image_set_from_file
+gtk_image_set_from_file PRIVATE
+#ifdef G_OS_WIN32
+gtk_image_set_from_file_utf8
+#endif
 gtk_image_set_from_icon_name
 gtk_image_set_from_icon_set
 gtk_image_set_from_image
@@ -1666,7 +1741,10 @@ gtk_range_set_range
 gtk_range_set_update_policy
 gtk_range_set_value
 gtk_rc_add_class_style
-gtk_rc_add_default_file
+gtk_rc_add_default_file PRIVATE
+#ifdef G_OS_WIN32
+gtk_rc_add_default_file_utf8
+#endif
 gtk_rc_add_widget_class_style
 gtk_rc_add_widget_name_style
 gtk_rc_find_module_in_path
@@ -1679,7 +1757,10 @@ gtk_rc_get_module_dir
 gtk_rc_get_style
 gtk_rc_get_style_by_paths
 gtk_rc_get_theme_dir
-gtk_rc_parse
+gtk_rc_parse PRIVATE
+#ifdef G_OS_WIN32
+gtk_rc_parse_utf8
+#endif
 gtk_rc_parse_color
 gtk_rc_parse_priority
 gtk_rc_parse_state
@@ -1693,7 +1774,10 @@ gtk_rc_reparse_all
 gtk_rc_reparse_all_for_settings
 gtk_rc_reset_styles
 gtk_rc_scanner_new
-gtk_rc_set_default_files
+gtk_rc_set_default_files PRIVATE
+#ifdef G_OS_WIN32
+gtk_rc_set_default_files_utf8
+#endif
 gtk_rc_style_copy
 gtk_rc_style_get_type G_GNUC_CONST
 gtk_rc_style_new
@@ -2627,7 +2711,10 @@ gtk_type_init
 gtk_type_new
 gtk_type_unique
 gtk_ui_manager_add_ui
-gtk_ui_manager_add_ui_from_file
+gtk_ui_manager_add_ui_from_file PRIVATE
+#ifdef G_OS_WIN32
+gtk_ui_manager_add_ui_from_file_utf8
+#endif
 gtk_ui_manager_add_ui_from_string
 gtk_ui_manager_ensure_update
 gtk_ui_manager_get_accel_group
@@ -2868,7 +2955,10 @@ gtk_window_set_auto_startup_notification
 gtk_window_set_decorated
 gtk_window_set_default
 gtk_window_set_default_icon
-gtk_window_set_default_icon_from_file
+gtk_window_set_default_icon_from_file PRIVATE
+#ifdef G_OS_WIN32
+gtk_window_set_default_icon_from_file_utf8
+#endif
 gtk_window_set_default_icon_list
 gtk_window_set_default_icon_name
 gtk_window_set_default_size
@@ -2880,7 +2970,10 @@ gtk_window_set_geometry_hints
 gtk_window_set_gravity
 gtk_window_set_has_frame
 gtk_window_set_icon
-gtk_window_set_icon_from_file
+gtk_window_set_icon_from_file PRIVATE
+#ifdef G_OS_WIN32
+gtk_window_set_icon_from_file_utf8
+#endif
 gtk_window_set_icon_list
 gtk_window_set_icon_name
 gtk_window_set_keep_above
index 647aa70d45c8b0fd6281cdbe89b5b88992ddfaff..c4cd681dd30170df9da6e4a3e3132a6d7f833734 100644 (file)
@@ -25,6 +25,8 @@
 #include "gtkmarshalers.h"
 #include "gtkwindow.h"  /* in lack of GtkAcceleratable */
 
+#include <glib/gstdio.h>
+
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -603,7 +605,8 @@ gtk_accel_map_load_fd (gint fd)
 
 /**
  * gtk_accel_map_load:
- * @file_name: a file containing accelerator specifications
+ * @file_name: a file containing accelerator specifications,
+ *   in the GLib file name encoding
  *
  * Parses a file previously saved with gtk_accel_map_save() for
  * accelerator specifications, and propagates them accordingly.
@@ -618,7 +621,7 @@ gtk_accel_map_load (const gchar *file_name)
   if (!g_file_test (file_name, G_FILE_TEST_IS_REGULAR))
     return;
 
-  fd = open (file_name, O_RDONLY);
+  fd = g_open (file_name, O_RDONLY, 0);
   if (fd < 0)
     return;
 
@@ -713,7 +716,8 @@ gtk_accel_map_save_fd (gint fd)
 
 /**
  * gtk_accel_map_save:
- * @file_name: the file to contain accelerator specifications
+ * @file_name: the name of the file to contain accelerator specifications,
+ *   in the GLib file name encoding
  *
  * Saves current accelerator specifications (accelerator path, key
  * and modifiers) to @file_name.
@@ -727,7 +731,7 @@ gtk_accel_map_save (const gchar *file_name)
 
   g_return_if_fail (file_name != NULL);
 
-  fd = open (file_name, O_CREAT | O_TRUNC | O_WRONLY, 0644);
+  fd = g_open (file_name, O_CREAT | O_TRUNC | O_WRONLY, 0644);
   if (fd < 0)
     return;
 
@@ -996,3 +1000,31 @@ do_accel_map_changed (AccelEntry *entry)
                   entry->accel_key,
                   entry->accel_mods);
 }
+
+#ifdef G_OS_WIN32
+
+#undef gtk_accel_map_load
+
+void
+gtk_accel_map_load (const gchar *file_name)
+{
+  gchar *utf8_file_name = g_locale_to_utf8 (file_name, -1, NULL, NULL, NULL);
+
+  gtk_accel_map_load_utf8 (utf8_file_name);
+
+  g_free (utf8_file_name);
+}
+
+#undef gtk_accel_map_save
+
+void
+gtk_accel_map_save (const gchar *file_name)
+{
+  gchar *utf8_file_name = g_locale_to_utf8 (file_name, -1, NULL, NULL, NULL);
+
+  gtk_accel_map_save_utf8 (utf8_file_name);
+
+  g_free (utf8_file_name);
+}
+
+#endif
index 934b2374a84ebf3ad920e7535c6ae55f6b58ae83..932c893ab3047fc0af564164ee702dcdb9e76cc7 100644 (file)
@@ -44,6 +44,13 @@ typedef void (*GtkAccelMapForeach)           (gpointer        data,
 
 
 /* --- public API --- */
+
+#ifdef G_OS_WIN32
+/* Reserve old names for DLL ABI backward compatibility */
+#define gtk_accel_map_load gtk_accel_map_load_utf8
+#define gtk_accel_map_save gtk_accel_map_save_utf8
+#endif
+
 void      gtk_accel_map_add_entry      (const gchar            *accel_path,
                                         guint                   accel_key,
                                         GdkModifierType         accel_mods);
index 59fe7b1b9dfd3ea7ccd493a088251a14888f6b2c..377838809aee9bc50776e575f52f97bf6bd8434b 100644 (file)
@@ -1827,3 +1827,172 @@ gtk_file_chooser_get_show_hidden (GtkFileChooser *chooser)
 
   return show_hidden;
 }
+
+#ifdef G_OS_WIN32
+
+/* DLL ABI stability backward compatibility versions */
+
+#undef gtk_file_chooser_get_filename
+
+gchar *
+gtk_file_chooser_get_filename (GtkFileChooser *chooser)
+{
+  gchar *utf8_filename = gtk_file_chooser_get_filename_utf8 (chooser);
+  gchar *retval = g_locale_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#undef gtk_file_chooser_set_filename
+
+gboolean
+gtk_file_chooser_set_filename (GtkFileChooser *chooser,
+                              const gchar    *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+  gboolean retval = gtk_file_chooser_set_filename_utf8 (chooser, utf8_filename);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#undef gtk_file_chooser_select_filename
+
+gboolean
+gtk_file_chooser_select_filename (GtkFileChooser *chooser,
+                                 const gchar    *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+  gboolean retval = gtk_file_chooser_select_filename_utf8 (chooser, utf8_filename);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#undef gtk_file_chooser_unselect_filename
+
+void
+gtk_file_chooser_unselect_filename (GtkFileChooser *chooser,
+                                   const char     *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+  gtk_file_chooser_unselect_filename_utf8 (chooser, utf8_filename);
+  g_free (utf8_filename);
+}
+
+#undef gtk_file_chooser_get_filenames
+
+GSList *
+gtk_file_chooser_get_filenames (GtkFileChooser *chooser)
+{
+  GSList *list = gtk_file_chooser_get_filenames_utf8 (chooser);
+  GSList *rover = list;
+  
+  while (rover)
+    {
+      gchar *tem = (gchar *) rover->data;
+      rover->data = g_locale_from_utf8 ((gchar *) rover->data, -1, NULL, NULL, NULL);
+      g_free (tem);
+      rover = rover->next;
+    }
+
+  return list;
+}
+
+#undef gtk_file_chooser_set_current_folder
+
+gboolean
+gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
+                                    const gchar    *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+  gboolean retval = gtk_file_chooser_set_current_folder_utf8 (chooser, utf8_filename);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#undef gtk_file_chooser_get_current_folder
+
+gchar *
+gtk_file_chooser_get_current_folder (GtkFileChooser *chooser)
+{
+  gchar *utf8_folder = gtk_file_chooser_get_current_folder_utf8 (chooser);
+  gchar *retval = g_locale_from_utf8 (utf8_folder, -1, NULL, NULL, NULL);
+
+  g_free (utf8_folder);
+
+  return retval;
+}
+
+#undef gtk_file_chooser_get_preview_filename
+
+char *
+gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser)
+{
+  char *utf8_filename = gtk_file_chooser_get_preview_filename_utf8 (chooser);
+  char *retval = g_locale_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#undef gtk_file_chooser_add_shortcut_folder
+
+gboolean
+gtk_file_chooser_add_shortcut_folder (GtkFileChooser    *chooser,
+                                     const char        *folder,
+                                     GError           **error)
+{
+  char *utf8_folder = g_locale_to_utf8 (folder, -1, NULL, NULL, NULL);
+  gboolean retval =
+    gtk_file_chooser_add_shortcut_folder_utf8 (chooser, utf8_folder, error);
+
+  g_free (utf8_folder);
+
+  return retval;
+}
+
+#undef gtk_file_chooser_remove_shortcut_folder
+
+gboolean
+gtk_file_chooser_remove_shortcut_folder (GtkFileChooser    *chooser,
+                                        const char        *folder,
+                                        GError           **error)
+{
+  char *utf8_folder = g_locale_to_utf8 (folder, -1, NULL, NULL, NULL);
+  gboolean retval =
+    gtk_file_chooser_remove_shortcut_folder_utf8 (chooser, utf8_folder, error);
+
+  g_free (utf8_folder);
+
+  return retval;
+}
+
+#undef gtk_file_chooser_list_shortcut_folders
+
+GSList *
+gtk_file_chooser_list_shortcut_folders (GtkFileChooser *chooser)
+{
+  GSList *list = gtk_file_chooser_list_shortcut_folders_utf8 (chooser);
+  GSList *rover = list;
+  
+  while (rover)
+    {
+      gchar *tem = (gchar *) rover->data;
+      rover->data = g_locale_from_utf8 ((gchar *) rover->data, -1, NULL, NULL, NULL);
+      g_free (tem);
+      rover = rover->next;
+    }
+
+  return list;
+}
+
+#endif
index 1078f53a77ee7b4a2ff2471bb13821fe51da0446..57ccbc4fc09bacb4a64c07587d3621f4e0821ab0 100644 (file)
@@ -75,6 +75,21 @@ void     gtk_file_chooser_set_current_name   (GtkFileChooser *chooser,
 
 /* Filename manipulation
  */
+#ifdef G_OS_WIN32
+/* Reserve old names for DLL ABI backward compatibility */
+#define gtk_file_chooser_get_filename gtk_file_chooser_get_filename_utf8
+#define gtk_file_chooser_set_filename gtk_file_chooser_set_filename_utf8
+#define gtk_file_chooser_select_filename gtk_file_chooser_select_filename_utf8
+#define gtk_file_chooser_unselect_filename gtk_file_chooser_unselect_filename_utf8
+#define gtk_file_chooser_get_filenames gtk_file_chooser_get_filenames_utf8
+#define gtk_file_chooser_set_current_folder gtk_file_chooser_set_current_folder_utf8
+#define gtk_file_chooser_get_current_folder gtk_file_chooser_get_current_folder_utf8
+#define gtk_file_chooser_get_preview_filename gtk_file_chooser_get_preview_filename_utf8
+#define gtk_file_chooser_add_shortcut_folder gtk_file_chooser_add_shortcut_folder_utf8
+#define gtk_file_chooser_remove_shortcut_folder gtk_file_chooser_remove_shortcut_folder_utf8
+#define gtk_file_chooser_list_shortcut_folders gtk_file_chooser_list_shortcut_folders_utf8
+#endif
+
 gchar *  gtk_file_chooser_get_filename       (GtkFileChooser *chooser);
 gboolean gtk_file_chooser_set_filename       (GtkFileChooser *chooser,
                                              const char     *filename);
index e75c96e55c869bffe405ff03edfb81770f24cdbb..5ab0abda8b648e309f2a7cde4c0d25d4a2e71fa3 100644 (file)
@@ -43,6 +43,7 @@
 #endif
 
 #include <glib.h>              /* Include early to get G_OS_WIN32 etc */
+#include <glib/gstdio.h>
 
 #if defined(G_PLATFORM_WIN32)
 #include <ctype.h>
@@ -89,7 +90,6 @@
 #ifdef G_OS_WIN32
 #include <direct.h>
 #include <io.h>
-#define mkdir(p,m) _mkdir(p)
 #ifndef S_ISDIR
 #define S_ISDIR(mode) ((mode)&_S_IFDIR)
 #endif
@@ -1194,7 +1194,7 @@ gtk_file_selection_hide_fileop_buttons (GtkFileSelection *filesel)
  * working directory and an empty filename, @filename must have a trailing
  * directory separator.
  *
- * The encoding of @filename is the on-disk encoding, which
+ * The encoding of @filename is preferred GLib file name encoding, which
  * may not be UTF-8. See g_filename_from_utf8().
  **/
 void
@@ -1239,11 +1239,10 @@ gtk_file_selection_set_filename (GtkFileSelection *filesel,
  * gtk_file_selection_get_filename:
  * @filesel: a #GtkFileSelection
  * 
- * This function returns the selected filename in the on-disk encoding
- * (see g_filename_from_utf8()), which may or may not be the same as that
- * used by GTK+ (UTF-8). To convert to UTF-8, call g_filename_to_utf8().
- * The returned string points to a statically allocated buffer and
- * should be copied if you plan to keep it around.
+ * This function returns the selected filename in the GLib file name
+ * encoding. To convert to UTF-8, call g_filename_to_utf8(). The
+ * returned string points to a statically allocated buffer and should
+ * be copied if you plan to keep it around.
  *
  * If no file is selected then the selected directory path is returned.
  * 
@@ -1253,7 +1252,7 @@ G_CONST_RETURN gchar*
 gtk_file_selection_get_filename (GtkFileSelection *filesel)
 {
   static const gchar nothing[2] = "";
-  static gchar something[MAXPATHLEN*2];
+  static gchar something[MAXPATHLEN*2+1];
   char *sys_filename;
   const char *text;
 
@@ -1270,7 +1269,8 @@ gtk_file_selection_get_filename (GtkFileSelection *filesel)
       g_free (fullname);
       if (!sys_filename)
        return nothing;
-      strncpy (something, sys_filename, sizeof (something));
+      strncpy (something, sys_filename, sizeof (something) - 1);
+      something[sizeof (something) - 1] = '\0';
       g_free (sys_filename);
       return something;
     }
@@ -1451,7 +1451,7 @@ gtk_file_selection_create_dir_confirmed (GtkWidget *widget,
       goto out;
     }
 
-  if (mkdir (sys_full_path, 0777) < 0)
+  if (g_mkdir (sys_full_path, 0777) < 0)
     {
       buf = g_strdup_printf (_("Error creating folder \"%s\": %s\n"), dirname,
                             g_strerror (errno));
@@ -1581,7 +1581,7 @@ gtk_file_selection_delete_file_response (GtkDialog *dialog,
       goto out;
     }
 
-  if (unlink (sys_full_path) < 0) 
+  if (g_unlink (sys_full_path) < 0) 
     {
       buf = g_strdup_printf (_("Error deleting file \"%s\": %s"),
                             fs->fileop_file, g_strerror (errno));
@@ -1701,7 +1701,7 @@ gtk_file_selection_rename_file_confirmed (GtkWidget *widget,
       goto out2;
     }
   
-  if (rename (sys_old_filename, sys_new_filename) < 0) 
+  if (g_rename (sys_old_filename, sys_new_filename) < 0) 
     {
       buf = g_strdup_printf (_("Error renaming file \"%s\" to \"%s\": %s"),
                             sys_old_filename, sys_new_filename,
@@ -2458,9 +2458,8 @@ maybe_clear_entry:
  * This function is intended for use when the user can select multiple files
  * in the file list. 
  *
- * The filenames are in the encoding of g_filename_from_utf8(), which may or 
- * may not be the same as that used by GTK+ (UTF-8). To convert to UTF-8, call
- * g_filename_to_utf8() on each string.
+ * The filenames are in the GLib file name encoding. To convert to
+ * UTF-8, call g_filename_to_utf8() on each string.
  *
  * Return value: a newly-allocated %NULL-terminated array of strings. Use
  * g_strfreev() to free it.
@@ -3172,7 +3171,7 @@ open_new_dir (gchar       *dir_name,
       if (stat_subdirs)
        {
          /* Here we know path->str is a "system charset" string */
-         if (stat (path->str, &ent_sbuf) >= 0 && S_ISDIR (ent_sbuf.st_mode))
+         if (g_stat (path->str, &ent_sbuf) >= 0 && S_ISDIR (ent_sbuf.st_mode))
            sent->entries[n_entries].is_dir = TRUE;
          else
            /* stat may fail, and we don't mind, since it could be a
@@ -3226,7 +3225,7 @@ check_dir (gchar       *dir_name,
       initialized = TRUE;
       for (i = 0; i < n_no_stat_dirs; i++)
        {
-         if (stat (no_stat_dirs[i].name, &no_stat_dirs[i].statbuf) == 0)
+         if (g_stat (no_stat_dirs[i].name, &no_stat_dirs[i].statbuf) == 0)
            no_stat_dirs[i].present = TRUE;
        }
     }
@@ -3238,7 +3237,7 @@ check_dir (gchar       *dir_name,
       return FALSE;
     }
   
-  if (stat (sys_dir_name, result) < 0)
+  if (g_stat (sys_dir_name, result) < 0)
     {
       g_free (sys_dir_name);
       cmpl_errno = errno;
@@ -3380,7 +3379,7 @@ correct_dir_fullname (CompletionDir* cmpl_dir)
          return FALSE;
        }
       
-      if (stat (sys_filename, &sbuf) < 0)
+      if (g_stat (sys_filename, &sbuf) < 0)
        {
          g_free (sys_filename);
          cmpl_errno = errno;
@@ -3414,7 +3413,7 @@ correct_dir_fullname (CompletionDir* cmpl_dir)
          return FALSE;
        }
       
-      if (stat (sys_filename, &sbuf) < 0)
+      if (g_stat (sys_filename, &sbuf) < 0)
        {
          g_free (sys_filename);
          cmpl_errno = errno;
@@ -3472,7 +3471,7 @@ correct_parent (CompletionDir *cmpl_dir,
       return FALSE;
     }
   
-  if (stat (sys_filename, &parbuf) < 0)
+  if (g_stat (sys_filename, &parbuf) < 0)
     {
       g_free (sys_filename);
       cmpl_errno = errno;
@@ -4036,3 +4035,59 @@ cmpl_strerror (gint err)
   else
     return g_strerror (err);
 }
+
+#ifdef G_OS_WIN32
+
+/* DLL ABI stability backward compatibility versions */
+
+#undef gtk_file_selection_get_filename
+
+G_CONST_RETURN gchar*
+gtk_file_selection_get_filename (GtkFileSelection *filesel)
+{
+  static gchar retval[MAXPATHLEN*2+1];
+  gchar *tem;
+
+  tem = g_locale_from_utf8 (gtk_file_selection_get_filename_utf8 (filesel),
+                           -1, NULL, NULL, NULL);
+
+  strncpy (retval, tem, sizeof (retval) - 1);
+  retval[sizeof (retval) - 1] = '\0';
+  g_free (tem);
+
+  return retval;
+}
+
+#undef gtk_file_selection_set_filename
+
+void
+gtk_file_selection_set_filename (GtkFileSelection *filesel,
+                                const gchar      *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+  gtk_file_selection_set_filename_utf8 (filesel, utf8_filename);
+  g_free (utf8_filename);
+}
+
+#undef gtk_file_selection_get_selections
+
+gchar **
+gtk_file_selection_get_selections (GtkFileSelection *filesel)
+{
+  int i = 0;
+  gchar **selections = gtk_file_selection_get_selections_utf8 (filesel);
+
+  if (selections != NULL)
+    while (selections[i] != NULL)
+      {
+       gchar *tem = selections[i];
+       selections[i] = g_locale_from_utf8 (selections[i],
+                                           -1, NULL, NULL, NULL);
+       g_free (tem);
+       i++;
+      }
+
+  return selections;
+}
+
+#endif /* G_OS_WIN32 */
index 9f819a17f8275a503efb57c4fd818faeba1cebfd..7595095d669129a75bb90dd5034dee7d9f2ab8d5 100644 (file)
@@ -94,16 +94,17 @@ struct _GtkFileSelectionClass
 };
 
 
+#ifdef G_OS_WIN32
+/* Reserve old names for DLL ABI backward compatibility */
+#define gtk_file_selection_get_filename gtk_file_selection_get_filename_utf8
+#define gtk_file_selection_set_filename gtk_file_selection_set_filename_utf8
+#define gtk_file_selection_get_selections gtk_file_selection_get_selections_utf8
+#endif
+
 GType      gtk_file_selection_get_type            (void) G_GNUC_CONST;
 GtkWidget* gtk_file_selection_new                 (const gchar      *title);
 void       gtk_file_selection_set_filename        (GtkFileSelection *filesel,
                                                   const gchar      *filename);
-/* This function returns the selected filename in the C runtime's
- * multibyte string encoding, which may or may not be the same as that
- * used by GDK (UTF-8). To convert to UTF-8, call g_filename_to_utf8().
- * The returned string points to a statically allocated buffer and
- * should be copied away.
- */
 G_CONST_RETURN gchar* gtk_file_selection_get_filename        (GtkFileSelection *filesel);
 
 void      gtk_file_selection_complete            (GtkFileSelection *filesel,
index f70fee98b2328725b14722738e8f277915ac1902..8687a9e08a6303c9d1d4ae5ee503cb27c1980888 100644 (file)
@@ -27,6 +27,8 @@
 #include "gtkstock.h"
 #include "gtkiconfactory.h"
 
+#include <glib/gstdio.h>
+
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
@@ -39,7 +41,6 @@
 #include <shellapi.h> /* ExtractAssociatedIcon */
 #include <direct.h>
 #include <io.h>
-#define mkdir(p,m) _mkdir(p)
 #include <gdk/win32/gdkwin32.h> /* gdk_win32_hdc_get */
 #else
 #error "The implementation is win32 only."
@@ -371,10 +372,10 @@ gtk_file_system_win32_get_volume_for_path (GtkFileSystem     *file_system,
 }
 
 static GtkFileFolder *
-gtk_file_system_win32_get_folder (GtkFileSystem    *file_system,
-                                const GtkFilePath *path,
-                                GtkFileInfoType    types,
-                                GError           **error)
+gtk_file_system_win32_get_folder (GtkFileSystem     *file_system,
+                                 const GtkFilePath *path,
+                                 GtkFileInfoType    types,
+                                 GError           **error)
 {
   GtkFileSystemWin32 *system_win32;
   GtkFileFolderWin32 *folder_win32;
@@ -393,7 +394,7 @@ gtk_file_system_win32_get_folder (GtkFileSystem    *file_system,
   if (!g_file_test (filename, G_FILE_TEST_IS_DIR))
     {
       int save_errno = errno;
-      gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+      gchar *display_filename = g_filename_display_name (filename);
 
       /* If g_file_test() returned FALSE but not due to an error, it means
        * that the filename is not a directory.
@@ -404,17 +405,17 @@ gtk_file_system_win32_get_folder (GtkFileSystem    *file_system,
                     GTK_FILE_SYSTEM_ERROR,
                     GTK_FILE_SYSTEM_ERROR_NOT_FOLDER,
                     _("%s: %s"),
-                    filename_utf8 ? filename_utf8 : "???",
+                    display_filename,
                     g_strerror (ENOTDIR));
       else
        g_set_error (error,
                     GTK_FILE_SYSTEM_ERROR,
                     GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
                     _("error getting information for '%s': %s"),
-                    filename_utf8 ? filename_utf8 : "???",
+                    display_filename,
                     g_strerror (save_errno));
 
-      g_free (filename_utf8);
+      g_free (display_filename);
       return NULL;
     }
 
@@ -443,18 +444,18 @@ gtk_file_system_win32_create_folder (GtkFileSystem     *file_system,
   filename = filename_from_path (path);
   g_return_val_if_fail (filename != NULL, FALSE);
 
-  result = mkdir (filename, 0777) == 0;
+  result = g_mkdir (filename, 0777) == 0;
 
   if (!result)
     {
-      gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+      gchar *display_filename = g_filename_display_name (filename);
       g_set_error (error,
                   GTK_FILE_SYSTEM_ERROR,
                   GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
                   _("error creating directory '%s': %s"),
-                  filename_utf8 ? filename_utf8 : "???",
+                  display_filename,
                   g_strerror (errno));
-      g_free (filename_utf8);
+      g_free (display_filename);
     }
   else if (!filename_is_drive_root (filename))
     {
@@ -517,7 +518,7 @@ gtk_file_system_win32_volume_mount (GtkFileSystem        *file_system,
 
 static gchar *
 gtk_file_system_win32_volume_get_display_name (GtkFileSystem       *file_system,
-                                             GtkFileSystemVolume *volume)
+                                              GtkFileSystemVolume *volume)
 {
   gchar *real_display_name;
   gunichar2 *wdrive = g_utf8_to_utf16 (volume->drive, -1, NULL, NULL, NULL);
@@ -526,12 +527,12 @@ gtk_file_system_win32_volume_get_display_name (GtkFileSystem       *file_system,
   g_return_val_if_fail (wdrive != NULL, NULL);
 
   if (GetVolumeInformationW (wdrive,
-                           wname, G_N_ELEMENTS(wname), 
-                            NULL, /* serial number */
-                            NULL, /* max. component length */
-                            NULL, /* fs flags */
-                            NULL, 0) /* fs type like FAT, NTFS */
-                           && wname[0])
+                            wname, G_N_ELEMENTS(wname), 
+                            NULL, /* serial number */
+                            NULL, /* max. component length */
+                            NULL, /* fs flags */
+                            NULL, 0) /* fs type like FAT, NTFS */
+      && wname[0])
     {
       gchar *name = g_utf16_to_utf8 (wname, -1, NULL, NULL, NULL);
       real_display_name = g_strconcat (name, " (", volume->drive, ")", NULL);
@@ -547,10 +548,10 @@ gtk_file_system_win32_volume_get_display_name (GtkFileSystem       *file_system,
 
 static GdkPixbuf *
 gtk_file_system_win32_volume_render_icon (GtkFileSystem        *file_system,
-                                        GtkFileSystemVolume  *volume,
-                                        GtkWidget            *widget,
-                                        gint                  pixel_size,
-                                        GError              **error)
+                                         GtkFileSystemVolume  *volume,
+                                         GtkWidget            *widget,
+                                         gint                  pixel_size,
+                                         GError              **error)
 {
   GtkIconSet *icon_set = NULL;
   DWORD dt = GetDriveType (volume->drive);
@@ -618,32 +619,15 @@ gtk_file_system_win32_make_path (GtkFileSystem     *file_system,
                                 GError           **error)
 {
   const char *base_filename;
-  gchar *filename;
   gchar *full_filename;
-  GError *tmp_error = NULL;
   GtkFilePath *result;
   
   base_filename = gtk_file_path_get_string (base_path);
   g_return_val_if_fail (base_filename != NULL, NULL);
   g_return_val_if_fail (g_path_is_absolute (base_filename), NULL);
 
-  filename = g_filename_from_utf8 (display_name, -1, NULL, NULL, &tmp_error);
-  if (!filename)
-    {
-      g_set_error (error,
-                  GTK_FILE_SYSTEM_ERROR,
-                  GTK_FILE_SYSTEM_ERROR_BAD_FILENAME,
-                  "%s",
-                  tmp_error->message);
-      
-      g_error_free (tmp_error);
-
-      return NULL;
-    }
-    
-  full_filename = g_build_filename (base_filename, filename, NULL);
+  full_filename = g_build_filename (base_filename, display_name, NULL);
   result = filename_to_path (full_filename);
-  g_free (filename);
   g_free (full_filename);
   
   return result;
@@ -780,19 +764,16 @@ gtk_file_system_win32_parse (GtkFileSystem     *file_system,
        {
          if (g_ascii_isalpha (base_filename[0]) &&
              base_filename[1] == ':')
-           folder_part = g_strdup_printf ("%c:%c", base_filename[0],
-                                          G_DIR_SEPARATOR);
+           folder_part = g_strdup_printf ("%c:" G_DIR_SEPARATOR_S, base_filename[0]);
          else
            folder_part = g_strdup (G_DIR_SEPARATOR_S);
        }
       else if (g_ascii_isalpha (str[0]) &&
               str[1] == ':' &&
               G_IS_DIR_SEPARATOR (str[2]))
-       folder_part = g_filename_from_utf8 (str, last_slash - str + 1,
-                                           NULL, NULL, &tmp_error);
+       folder_part = g_strdup_printf ("%c:" G_DIR_SEPARATOR_S, str[0]);
       else
-       folder_part = g_filename_from_utf8 (str, last_slash - str,
-                                           NULL, NULL, &tmp_error);
+       folder_part = g_strndup (str, last_slash - str);
 
       if (!folder_part)
        {
@@ -904,7 +885,7 @@ bookmarks_serialize (GSList  **bookmarks,
          else
            ok = FALSE;
        }
-      if (ok && (f = fopen (filename, "wb")) != NULL)
+      if (ok && (f = g_fopen (filename, "wb")) != NULL)
         {
          entry = g_slist_find_custom (list, uri, (GCompareFunc) strcmp);
          if (add)
@@ -1294,7 +1275,6 @@ gtk_file_folder_win32_get_info (GtkFileFolder     *folder,
 {
   GtkFileFolderWin32 *folder_win32 = GTK_FILE_FOLDER_WIN32 (folder);
   GtkFileInfo *info;
-  gchar *dirname;
   gchar *filename;
   
   if (!path)
@@ -1310,12 +1290,6 @@ gtk_file_folder_win32_get_info (GtkFileFolder     *folder,
   filename = filename_from_path (path);
   g_return_val_if_fail (filename != NULL, NULL);
 
-#if 0
-  dirname = g_path_get_dirname (filename);
-  g_return_val_if_fail (strcmp (dirname, folder_win32->filename) == 0, NULL);
-  g_free (dirname);
-#endif
-
   info = filename_get_info (filename, folder_win32->types, error);
 
   g_free (filename);
@@ -1378,17 +1352,39 @@ filename_get_info (const gchar     *filename,
   GtkFileIconType icon_type = GTK_FILE_ICON_REGULAR;
 #endif
   WIN32_FILE_ATTRIBUTE_DATA wfad;
+  int rc = 0;
 
-  if (!GetFileAttributesEx (filename, GetFileExInfoStandard, &wfad))
+  if (G_WIN32_HAVE_WIDECHAR_API ())
     {
-      gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, error);
+
+      if (!wfilename)
+       return NULL;
+
+      rc = GetFileAttributesExW (wfilename, GetFileExInfoStandard, &wfad);
+      g_free (wfilename);
+    }
+  else
+    {
+      char *cpfilename = g_locale_from_utf8 (filename, -1, NULL, NULL, error);
+
+      if (!cpfilename)
+       return NULL;
+
+      rc = GetFileAttributesExA (cpfilename, GetFileExInfoStandard, &wfad);
+      g_free (cpfilename);
+    }
+
+  if (!rc)
+    {
+      gchar *display_filename = g_filename_display_name (filename);
       g_set_error (error,
                   GTK_FILE_SYSTEM_ERROR,
                   GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
                   _("error getting information for '%s': %s"),
-                  filename_utf8 ? filename_utf8 : "???",
+                  display_filename,
                   g_win32_error_message (GetLastError ()));
-      g_free (filename_utf8);
+      g_free (display_filename);
       
       return NULL;
     }
@@ -1409,21 +1405,17 @@ filename_get_info (const gchar     *filename,
   
       if (types & GTK_FILE_INFO_DISPLAY_NAME)
        {
-         gchar *display_name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
-         if (!display_name)
-           display_name = g_strescape (basename, NULL);
-         
-         gtk_file_info_set_display_name (info, display_name);
+         gchar *display_basename = g_filename_display_name (basename);
          
-         g_free (display_name);
+         gtk_file_info_set_display_name (info, display_basename);
+         g_free (display_basename);
        }
       
       if (types & GTK_FILE_INFO_IS_HIDDEN)
        {
-            /* win32 convention ... */
-            gboolean is_hidden = basename[0] == '.';
-            /* ... _and_ windoze attribute */
-            is_hidden = is_hidden || !!(wfad.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN);
+         /* Unix dot convention or the Windows hidden attribute */
+         gboolean is_hidden = basename[0] == '.' ||
+           !!(wfad.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN);
          gtk_file_info_set_is_hidden (info, is_hidden);
        }
 
index 03f6f3bf440ab796c295a15998dae52fb292ea23..fc44d036de527d5805305338e66a666799c228ea 100644 (file)
 #include <config.h>
 #include "gtkdebug.h"
 #include "gtkiconcache.h"
+#include <glib/gstdio.h>
 
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
 #endif
 #ifdef G_OS_WIN32
+#include <windows.h>
 #include <io.h>
 #endif
 #include <sys/types.h>
 #include <fcntl.h>
 #include <string.h>
 
+#ifndef _O_BINARY
+#define _O_BINARY 0
+#endif
+
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 
@@ -46,6 +52,9 @@ struct _GtkIconCache {
 
   gsize size;
   gchar *buffer;
+#ifdef G_OS_WIN32
+  HANDLE handle;
+#endif
 };
 
 GtkIconCache *
@@ -66,6 +75,10 @@ _gtk_icon_cache_unref (GtkIconCache *cache)
                g_print ("unmapping icon cache\n"));
 #ifdef HAVE_MMAP
       munmap (cache->buffer, cache->size);
+#endif
+#ifdef G_OS_WIN32
+      UnmapViewOfFile (cache->buffer);
+      CloseHandle (cache->handle);
 #endif
       g_free (cache);
     }
@@ -75,12 +88,16 @@ GtkIconCache *
 _gtk_icon_cache_new_for_path (const gchar *path)
 {
   GtkIconCache *cache = NULL;
-#ifdef HAVE_MMAP
+
+#if defined(HAVE_MMAP) || defined(G_OS_WIN32)
   gchar *cache_filename;
-  gint fd;
+  gint fd = -1;
   struct stat st;
   struct stat path_st;
-  gchar *buffer;
+  gchar *buffer = NULL;
+#ifdef G_OS_WIN32
+  HANDLE handle = NULL;
+#endif
 
   if (g_getenv ("GTK_NO_ICON_CACHE"))
     return NULL;
@@ -91,8 +108,14 @@ _gtk_icon_cache_new_for_path (const gchar *path)
   GTK_NOTE (ICONTHEME, 
            g_print ("look for cache in %s\n", path));
 
-  /* Open the file and mmap it */
-  fd = open (cache_filename, O_RDONLY);
+  if (!g_file_test (cache_filename, G_FILE_TEST_IS_REGULAR))
+    goto done;
+
+  if (g_stat (path, &path_st) < 0)
+    goto done;
+
+  /* Open the file and map it into memory */
+  fd = g_open (cache_filename, O_RDONLY|_O_BINARY, 0);
 
   if (fd < 0)
     {
@@ -100,15 +123,9 @@ _gtk_icon_cache_new_for_path (const gchar *path)
       return NULL;
     }
   
-  if (!g_file_test (cache_filename, G_FILE_TEST_IS_REGULAR))
-    goto done;
-
   if (fstat (fd, &st) < 0 || st.st_size < 4)
     goto done;
 
-  if (stat (path, &path_st) < 0)
-    goto done;
-
   /* Verify cache is uptodate */
   if (st.st_mtime < path_st.st_mtime)
     {
@@ -117,16 +134,36 @@ _gtk_icon_cache_new_for_path (const gchar *path)
       goto done; 
     }
 
+#ifndef G_OS_WIN32
   buffer = (gchar *) mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
 
   if (buffer == MAP_FAILED)
     goto done;
+#else
+  handle = CreateFileMapping (_get_osfhandle (fd), NULL, PAGE_READONLY,
+                             0, 0, NULL);
+  if (handle == NULL)
+    goto done;
+
+  buffer = MapViewOfFile (handle, FILE_MAP_READ, 0, 0, 0);
+
+  if (buffer == NULL)
+    {
+      CloseHandle (handle);
+      goto done;
+    }
+#endif
 
   /* Verify version */
   if (GET_UINT16 (buffer, 0) != MAJOR_VERSION ||
       GET_UINT16 (buffer, 2) != MINOR_VERSION)
     {
+#ifndef G_OS_WIN32
       munmap (buffer, st.st_size);
+#else
+      UnmapViewOfFile (buffer);
+      CloseHandle (handle);
+#endif
       GTK_NOTE (ICONTHEME, 
                g_print ("wrong cache version\n"));
       goto done;
@@ -138,12 +175,16 @@ _gtk_icon_cache_new_for_path (const gchar *path)
   cache = g_new0 (GtkIconCache, 1);
   cache->ref_count = 1;
   cache->buffer = buffer;
+#ifdef G_OS_WIN32
+  cache->handle = handle;
+#endif
   cache->size = st.st_size;
  done:
   g_free (cache_filename);  
-  close (fd);
+  if (fd != -1)
+    close (fd);
 
-#endif  /* HAVE_MMAP */
+#endif  /* HAVE_MMAP || G_OS_WIN32 */
 
   return cache;
 }
index daa68c63cb432abb405d2d83b4c8f99824453f86..ceec68cb504fc12d32a3ab79566faaec8ab96d1f 100644 (file)
@@ -58,7 +58,7 @@ struct _GtkIconSource
     gchar *filename;
     GdkPixbuf *pixbuf;
   } source;
-  
+
   GdkPixbuf *filename_pixbuf;
 
   GtkTextDirection direction;
@@ -72,6 +72,13 @@ struct _GtkIconSource
   guint any_direction : 1;
   guint any_state : 1;
   guint any_size : 1;
+
+#ifdef G_OS_WIN32
+  /* System codepage version of filename, for DLL ABI backward
+   * compatibility functions.
+   */
+  gchar *cp_filename;
+#endif
 };
 
 static gpointer parent_class = NULL;
@@ -2131,6 +2138,9 @@ gtk_icon_source_copy (const GtkIconSource *source)
       break;
     case GTK_ICON_SOURCE_FILENAME:
       copy->source.filename = g_strdup (copy->source.filename);
+#ifdef G_OS_WIN32
+      copy->cp_filename = g_strdup (copy->cp_filename);
+#endif
       if (copy->filename_pixbuf)
        g_object_ref (copy->filename_pixbuf);
       break;
@@ -2187,6 +2197,10 @@ icon_source_clear (GtkIconSource *source)
     case GTK_ICON_SOURCE_FILENAME:
       g_free (source->source.filename);
       source->source.filename = NULL;
+#ifdef G_OS_WIN32
+      g_free (source->cp_filename);
+      source->cp_filename = NULL;
+#endif
       if (source->filename_pixbuf) 
        g_object_unref (source->filename_pixbuf);
       source->filename_pixbuf = NULL;
@@ -2227,6 +2241,9 @@ gtk_icon_source_set_filename (GtkIconSource *source,
     {
       source->type = GTK_ICON_SOURCE_FILENAME;
       source->source.filename = g_strdup (filename);
+#ifdef G_OS_WIN32
+      source->cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
+#endif
     }
 }
 
@@ -2939,3 +2956,35 @@ _gtk_icon_factory_list_ids (void)
 
   return ids;
 }
+
+#ifdef G_OS_WIN32
+
+/* DLL ABI stability backward compatibility versions */
+
+#undef gtk_icon_source_set_filename
+
+void
+gtk_icon_source_set_filename (GtkIconSource *source,
+                             const gchar   *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+  gtk_icon_source_set_filename_utf8 (source, utf8_filename);
+
+  g_free (utf8_filename);
+}
+
+#undef gtk_icon_source_get_filename
+
+G_CONST_RETURN gchar*
+gtk_icon_source_get_filename (const GtkIconSource *source)
+{
+  g_return_val_if_fail (source != NULL, NULL);
+
+  if (source->type == GTK_ICON_SOURCE_FILENAME)
+    return source->cp_filename;
+  else
+    return NULL;
+}
+
+#endif
index fd22b8db54d55b780da0d4189b2b8730d06506cf..43c90a30bc6993419cceec7ca9e3627f8302ab04 100644 (file)
@@ -63,6 +63,12 @@ struct _GtkIconFactoryClass
   void (*_gtk_reserved4) (void);
 };
 
+#ifdef G_OS_WIN32
+/* Reserve old names for DLL ABI backward compatibility */
+#define gtk_icon_source_set_filename gtk_icon_source_set_filename_utf8
+#define gtk_icon_source_get_filename gtk_icon_source_get_filename_utf8
+#endif
+
 GType           gtk_icon_factory_get_type (void) G_GNUC_CONST;
 GtkIconFactory* gtk_icon_factory_new      (void);
 void            gtk_icon_factory_add      (GtkIconFactory *factory,
index e5fa20106683f97f10742e22dfc5bdc1729eef57..09336f66787a7aa9bf9c1e53ddae2444644dd96d 100644 (file)
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <glib.h>
+#include <glib/gstdio.h>
 #include "gtkalias.h"
 
 #ifdef G_OS_WIN32
@@ -103,6 +104,12 @@ struct _GtkIconInfo
   /* Information about the source
    */
   gchar *filename;
+#ifdef G_OS_WIN32
+  /* System codepage version of filename, for DLL ABI backward
+   * compatibility functions.
+   */
+  gchar *cp_filename;
+#endif
   GdkPixbuf *builtin_pixbuf;
 
   GtkIconData *data;
@@ -885,7 +892,7 @@ insert_theme (GtkIconTheme *icon_theme, const char *theme_name)
                               NULL);
       dir_mtime = g_new (IconThemeDirMtime, 1);
       dir_mtime->dir = path;
-      if (stat (path, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode))
+      if (g_stat (path, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode))
        dir_mtime->mtime = stat_buf.st_mtime;
       else
        dir_mtime->mtime = 0;
@@ -1214,6 +1221,10 @@ gtk_icon_theme_lookup_icon (GtkIconTheme       *icon_theme,
        icon_info->filename = g_strdup (unthemed_icon->svg_filename);
       else if (unthemed_icon->no_svg_filename)
        icon_info->filename = g_strdup (unthemed_icon->no_svg_filename);
+#ifdef G_OS_WIN32
+      icon_info->cp_filename = g_locale_from_utf8 (icon_info->filename,
+                                                  -1, NULL, NULL, NULL);
+#endif
 
       icon_info->dir_type = ICON_THEME_DIR_UNTHEMED;
     }
@@ -1629,7 +1640,7 @@ gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme)
     {
       dir_mtime = d->data;
 
-      stat_res = stat (dir_mtime->dir, &stat_buf);
+      stat_res = g_stat (dir_mtime->dir, &stat_buf);
 
       /* dir mtime didn't change */
       if (stat_res == 0 && 
@@ -1880,7 +1891,10 @@ theme_lookup_icon (IconTheme          *theme,
       file = g_strconcat (icon_name, string_from_suffix (suffix), NULL);
       icon_info->filename = g_build_filename (min_dir->dir, file, NULL);
       g_free (file);
-
+#ifdef G_OS_WIN32
+      icon_info->cp_filename = g_locale_from_utf8 (icon_info->filename,
+                                                  -1, NULL, NULL, NULL);
+#endif
       if (min_dir->cache && has_icon_file)
        {
          gchar *icon_file_name, *icon_file_path;
@@ -2282,6 +2296,10 @@ gtk_icon_info_copy (GtkIconInfo *icon_info)
     copy->load_error = g_error_copy (copy->load_error);
   if (copy->filename)
     copy->filename = g_strdup (copy->filename);
+#ifdef G_OS_WIN32
+  if (copy->cp_filename)
+    copy->cp_filename = g_strdup (copy->cp_filename);
+#endif
 
   return copy;
 }
@@ -2301,6 +2319,10 @@ gtk_icon_info_free (GtkIconInfo *icon_info)
 
   if (icon_info->filename)
     g_free (icon_info->filename);
+#ifdef G_OS_WIN32
+  if (icon_info->cp_filename)
+    g_free (icon_info->cp_filename);
+#endif
   if (icon_info->builtin_pixbuf)
     g_object_unref (icon_info->builtin_pixbuf);
   if (icon_info->pixbuf)
@@ -2900,3 +2922,94 @@ find_builtin_icon (const gchar *icon_name,
 
   return min_icon;
 }
+
+#ifdef G_OS_WIN32
+
+/* DLL ABI stability backward compatibility versions */
+
+#undef gtk_icon_theme_set_search_path
+
+void
+gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme,
+                               const gchar  *path[],
+                               gint          n_elements)
+{
+  const gchar **utf8_path;
+  gint i;
+
+  utf8_path = g_new (const gchar *, n_elements);
+
+  for (i = 0; i < n_elements; i++)
+    utf8_path[i] = g_locale_to_utf8 (path[i], -1, NULL, NULL, NULL);
+
+  gtk_icon_theme_set_search_path_utf8 (icon_theme, utf8_path, n_elements);
+
+  for (i = 0; i < n_elements; i++)
+    g_free ((gchar *) utf8_path[i]);
+
+  g_free (utf8_path);
+}
+
+#undef gtk_icon_theme_get_search_path
+
+void
+gtk_icon_theme_get_search_path (GtkIconTheme      *icon_theme,
+                               gchar            **path[],
+                               gint              *n_elements)
+{
+  gint i, n;
+
+  gtk_icon_theme_get_search_path_utf8 (icon_theme, path, &n);
+
+  if (n_elements)
+    *n_elements = n;
+
+  if (path)
+    {
+      for (i = 0; i < n; i++)
+       {
+         gchar *tem = (*path)[i];
+
+         (*path)[i] = g_locale_from_utf8 ((*path)[i], -1, NULL, NULL, NULL);
+         g_free (tem);
+       }
+    }
+}
+
+#undef gtk_icon_theme_append_search_path
+
+void
+gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme,
+                                  const gchar  *path)
+{
+  gchar *utf8_path = g_locale_from_utf8 (path, -1, NULL, NULL, NULL);
+
+  gtk_icon_theme_append_search_path_utf8 (icon_theme, utf8_path);
+
+  g_free (utf8_path);
+}
+
+#undef gtk_icon_theme_prepend_search_path
+
+void
+gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme,
+                                   const gchar  *path)
+{
+  gchar *utf8_path = g_locale_from_utf8 (path, -1, NULL, NULL, NULL);
+
+  gtk_icon_theme_prepend_search_path_utf8 (icon_theme, utf8_path);
+
+  g_free (utf8_path);
+}
+
+#undef gtk_icon_info_get_filename
+
+G_CONST_RETURN gchar *
+gtk_icon_info_get_filename (GtkIconInfo *icon_info)
+{
+  g_return_val_if_fail (icon_info != NULL, NULL);
+
+  return icon_info->cp_filename;
+}
+
+#endif
index 7b7f2b1fc392b79c99bfaf64e738c9156e2f45ca..7b8bef1f89e2390b34d8adad5ccba517ec8dcf94 100644 (file)
@@ -92,6 +92,15 @@ typedef enum {
 
 GQuark gtk_icon_theme_error_quark (void);
 
+#ifdef G_OS_WIN32
+/* Reserve old name for DLL ABI backward compatibility */
+#define gtk_icon_theme_set_search_path gtk_icon_theme_set_search_path_utf8
+#define gtk_icon_theme_get_search_path gtk_icon_theme_get_search_path_utf8
+#define gtk_icon_theme_append_search_path gtk_icon_theme_append_search_path_utf8
+#define gtk_icon_theme_prepend_search_path gtk_icon_theme_prepend_search_path_utf8
+#define gtk_icon_info_get_filename gtk_icon_info_get_filename_utf8
+#endif
+
 GType         gtk_icon_theme_get_type              (void) G_GNUC_CONST;
 
 GtkIconTheme *gtk_icon_theme_new                   (void);
index de530f08d4fb829314e834163483e60e8cd65d3a..577f483106f50f25207a00b7c6b327ffb02683bb 100644 (file)
@@ -2106,3 +2106,35 @@ gtk_image_get_pixel_size (GtkImage *image)
 
   return priv->pixel_size;
 }
+
+#ifdef G_OS_WIN32
+
+#undef gtk_image_new_from_file
+
+GtkWidget*
+gtk_image_new_from_file   (const gchar *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+  GtkWidget *retval;
+
+  retval = gtk_image_new_from_file_utf8 (utf8_filename);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#undef gtk_image_set_from_file
+
+void
+gtk_image_set_from_file   (GtkImage    *image,
+                           const gchar *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+  gtk_image_set_from_file_utf8 (image, utf8_filename);
+
+  g_free (utf8_filename);
+}
+
+#endif
index a84928d03767112c458bb9bd3795d119d5683073..829666220bb6b24e7882c900225b1a9211b1c5e1 100644 (file)
@@ -141,6 +141,12 @@ struct _GtkImageClass
   void (*_gtk_reserved4) (void);
 };
 
+#ifdef G_OS_WIN32
+/* Reserve old names for DLL ABI backward compatibility */
+#define gtk_image_new_from_file gtk_image_new_from_file_utf8
+#define gtk_image_set_from_file gtk_image_set_from_file_utf8
+#endif
+
 GType      gtk_image_get_type (void) G_GNUC_CONST;
 
 GtkWidget* gtk_image_new                (void);
index 8043d2cca6c6f8dc3040999b8f8209d10839596a..7de9133f7e8b7a1b00c408f7b5725aa9fd8ef906 100644 (file)
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <glib/gstdio.h>
 #include <gmodule.h>
 #include <pango/pango-utils.h>
 #include "gtkalias.h"
  * else.
  */
 
+#ifdef __GTK_PRIVATE_H__
+#error gtkprivate.h should not be included in this file
+#endif
+
 #define SIMPLE_ID "gtk-im-context-simple"
 
 typedef struct _GtkIMModule      GtkIMModule;
@@ -279,7 +284,7 @@ gtk_im_module_init (void)
 
   contexts_hash = g_hash_table_new (g_str_hash, g_str_equal);
 
-  file = fopen (filename, "r");
+  file = g_fopen (filename, "r");
   if (!file)
     {
       /* In case someone wants only the default input method,
@@ -353,7 +358,7 @@ gtk_im_module_init (void)
            goto context_error;
          info->domain_dirname = g_strdup (tmp_buf->str);
 #ifdef DO_CORRECT_LIBDIR_PREFIX
-         correct_libdir_prefix (&info->domain_dirname);
+         correct_libdir_prefix ((char **) &info->domain_dirname);
 #endif
 
          if (!pango_scan_string (&p, tmp_buf))
index 0bec50a574cef4430c87b9e02bb1cfc8a7a20908..2e73f1bfedeb4a6d407e9e16fb154943d82de0be 100644 (file)
@@ -70,6 +70,13 @@ get_module_path (void)
   module_path_env = g_getenv ("GTK_PATH");
   exe_prefix = g_getenv ("GTK_EXE_PREFIX");
 
+#ifdef G_OS_WIN32
+  if (module_path_env)
+    module_path_env = g_locale_to_utf8 (module_path_env, -1, NULL, NULL, NULL);
+  if (exe_prefix)
+    exe_prefix =  g_locale_to_utf8 (exe_prefix, -1, NULL, NULL, NULL);
+#endif
+
   if (exe_prefix)
     default_dir = g_build_filename (exe_prefix, "lib", "gtk-2.0", NULL);
   else
@@ -88,6 +95,13 @@ get_module_path (void)
     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
                                default_dir, NULL);
 
+#ifdef G_OS_WIN32
+  if (module_path_env)
+    g_free ((void *) module_path_env);
+  if (exe_prefix)
+    g_free ((void *) exe_prefix);
+#endif
+
   g_free (home_gtk_dir);
   g_free (default_dir);
 
index 69b429e7d0542baa9a9c1ef9ff5aac42a125e6e6..ccbe5b4cba08da141b4cb022ecc093ba455bfb15 100644 (file)
 
 #include "gtkalias.h"
 
-#ifndef HAVE_LSTAT
-#define lstat stat
-#endif
-
 #include <glib.h>
+#include <glib/gstdio.h>
 #include "gdkconfig.h"
 
 #include "gtkversion.h"
@@ -313,11 +310,21 @@ gtk_rc_make_default_dir (const gchar *type)
   gchar *path;
 
   var = g_getenv ("GTK_EXE_PREFIX");
+
+#ifdef G_OS_WIN32
+  if (var)
+    var = g_locale_to_utf8 (var, -1, NULL, NULL, NULL);
+#endif
+
   if (var)
     path = g_build_filename (var, "lib", "gtk-2.0", GTK_BINARY_VERSION, type, NULL);
   else
     path = g_build_filename (GTK_LIBDIR, "gtk-2.0", GTK_BINARY_VERSION, type, NULL);
 
+#ifdef G_OS_WIN32
+  g_free ((void *) var);
+#endif
+
   return path;
 }
 
@@ -354,7 +361,16 @@ gtk_rc_get_im_module_path (void)
 gchar *
 gtk_rc_get_im_module_file (void)
 {
-  gchar *result = g_strdup (g_getenv ("GTK_IM_MODULE_FILE"));
+  const gchar *var = g_getenv ("GTK_IM_MODULE_FILE");
+  gchar *result = NULL;
+
+#ifdef G_OS_WIN32
+  if (var)
+    var = g_locale_to_utf8 (var, -1, NULL, NULL, NULL);
+#endif
+
+  if (var)
+    result = g_strdup (var);
 
   if (!result)
     {
@@ -364,6 +380,11 @@ gtk_rc_get_im_module_file (void)
        result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL);
     }
 
+#ifdef G_OS_WIN32
+  if (var)
+    g_free ((void *) var);
+#endif
+
   return result;
 }
 
@@ -374,11 +395,22 @@ gtk_rc_get_theme_dir (void)
   gchar *path;
 
   var = g_getenv ("GTK_DATA_PREFIX");
+
+#ifdef G_OS_WIN32
+  if (var)
+    var = g_locale_to_utf8 (var, -1, NULL, NULL, NULL);
+#endif
+
   if (var)
     path = g_build_filename (var, "share", "themes", NULL);
   else
     path = g_build_filename (GTK_DATA_PREFIX, "share", "themes", NULL);
 
+#ifdef G_OS_WIN32
+  if (var)
+    g_free ((void *) var);
+#endif
+
   return path;
 }
 
@@ -414,6 +446,12 @@ gtk_rc_add_initial_default_files (void)
   init = TRUE;
 
   var = g_getenv ("GTK2_RC_FILES");
+
+#ifdef G_OS_WIN32
+  if (var)
+    var = g_locale_to_utf8 (var, -1, NULL, NULL, NULL);
+#endif
+
   if (var)
     {
       files = g_strsplit (var, G_SEARCHPATH_SEPARATOR_S, 128);
@@ -427,19 +465,25 @@ gtk_rc_add_initial_default_files (void)
     }
   else
     {
+      const gchar *home;
       str = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtkrc", NULL);
 
       gtk_rc_add_default_file (str);
       g_free (str);
 
-      var = g_get_home_dir ();
-      if (var)
+      home = g_get_home_dir ();
+      if (home)
        {
-         str = g_build_filename (var, ".gtkrc-2.0", NULL);
+         str = g_build_filename (home, ".gtkrc-2.0", NULL);
          gtk_rc_add_default_file (str);
          g_free (str);
        }
     }
+
+#ifdef G_OS_WIN32
+  if (var)
+    g_free ((void *) var);
+#endif
 }
 
 /**
@@ -805,13 +849,13 @@ gtk_rc_context_parse_one_file (GtkRcContext *context,
   if (g_slist_find (current_files_stack, rc_file))
     return;
 
-  if (!lstat (rc_file->canonical_name, &statbuf))
+  if (!g_lstat (rc_file->canonical_name, &statbuf))
     {
       gint fd;
       
       rc_file->mtime = statbuf.st_mtime;
 
-      fd = open (rc_file->canonical_name, O_RDONLY);
+      fd = g_open (rc_file->canonical_name, O_RDONLY, 0);
       if (fd < 0)
        goto out;
 
@@ -1457,7 +1501,7 @@ gtk_rc_reparse_all_for_settings (GtkSettings *settings,
 
          if (!rc_file->is_string)
            {
-             if (!lstat (rc_file->name, &statbuf) && 
+             if (!g_lstat (rc_file->name, &statbuf) && 
                  (statbuf.st_mtime > rc_file->mtime))
                {
                  mtime_modified = TRUE;
@@ -3907,3 +3951,56 @@ gtk_rc_parse_stock (GtkRcContext   *context,
 
   return G_TOKEN_NONE;
 }
+
+#ifdef G_OS_WIN32
+
+/* DLL ABI stability backward compatibility versions */
+
+#undef gtk_rc_add_default_file
+
+void
+gtk_rc_add_default_file (const gchar *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+  gtk_rc_add_default_file_utf8 (utf8_filename);
+
+  g_free (utf8_filename);
+}
+
+#undef gtk_rc_set_default_files
+
+void
+gtk_rc_set_default_files (gchar **filenames)
+{
+  gchar **utf8_filenames;
+  int n = 0, i;
+
+  while (filenames[n++] != NULL)
+    ;
+
+  utf8_filenames = g_new (gchar *, n + 1);
+
+  for (i = 0; i < n; i++)
+    utf8_filenames[i] = g_locale_to_utf8 (filenames[i], -1, NULL, NULL, NULL);
+
+  utf8_filenames[n] = NULL;
+
+  gtk_rc_set_default_files_utf8 (utf8_filenames);
+
+  g_strfreev (utf8_filenames);
+}
+
+#undef gtk_rc_parse
+
+void
+gtk_rc_parse (const gchar *filename)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+  gtk_rc_parse_utf8 (utf8_filename);
+
+  g_free (utf8_filename);
+}
+
+#endif
index 426937bf7e81daee382c28749e2791544a204b6f..037eb927758560581a18c16080781ee2944de2b6 100644 (file)
@@ -121,6 +121,13 @@ struct _GtkRcStyleClass
   void (*_gtk_reserved4) (void);
 };
 
+#ifdef G_OS_WIN32
+/* Reserve old names for DLL ABI backward compatibility */
+#define gtk_rc_add_default_file gtk_rc_add_default_file_utf8
+#define gtk_rc_set_default_files gtk_rc_set_default_files_utf8
+#define gtk_rc_parse gtk_rc_parse_utf8
+#endif
+
 void     _gtk_rc_init                  (void);
 void      gtk_rc_add_default_file      (const gchar *filename);
 void      gtk_rc_set_default_files      (gchar **filenames);
index 75a1f86af836486b42268a1d88c99d5310cbaaa4..b5c9379ccaa2f904475ab890e925da028a78f247 100644 (file)
@@ -2752,3 +2752,26 @@ gtk_ui_manager_get_ui (GtkUIManager *self)
   return g_string_free (buffer, FALSE);
 }
 
+#ifdef G_OS_WIN32
+
+#undef gtk_ui_manager_add_ui_from_file
+
+guint
+gtk_ui_manager_add_ui_from_file (GtkUIManager *self,
+                                const gchar  *filename,
+                                GError      **error)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error);
+  guint retval;
+
+  if (utf8_filename == NULL)
+    return 0;
+  
+  retval = gtk_ui_manager_add_ui_from_file_utf8 (self, utf8_filename, error);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#endif
index 931925f71cf0ff7674ceb881cbee5858dc0f016d..7e1e6ead68e5eb265e6bdcf9f619b4b26431355f 100644 (file)
@@ -102,6 +102,11 @@ typedef enum {
   GTK_UI_MANAGER_ACCELERATOR  = 1 << 8
 } GtkUIManagerItemType;
 
+#ifdef G_OS_WIN32
+/* Reserve old name for DLL ABI backward compatibility */
+#define gtk_ui_manager_add_ui_from_file gtk_ui_manager_add_ui_from_file_utf8
+#endif
+
 GType          gtk_ui_manager_get_type            (void) G_GNUC_CONST;
 GtkUIManager  *gtk_ui_manager_new                 (void);
 void           gtk_ui_manager_set_add_tearoffs    (GtkUIManager          *self,
index d54e417c29d664e8447fe513f4f799b212e70654..3fbf1716c939b359ff1389006e8b0fe121a5e337 100644 (file)
@@ -7451,3 +7451,46 @@ gtk_window_set_auto_startup_notification (gboolean setting)
 {
   disable_startup_notification = !setting;
 }
+
+#ifdef G_OS_WIN32
+
+#undef gtk_window_set_icon_from_file
+
+gboolean
+gtk_window_set_icon_from_file (GtkWindow   *window,
+                              const gchar *filename,
+                              GError     **err)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, err);
+  gboolean retval;
+
+  if (utf8_filename == NULL)
+    return FALSE;
+
+  retval = gtk_window_set_icon_from_file_utf8 (window, utf8_filename, err);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#undef gtk_window_set_default_icon_from_file
+
+gboolean
+gtk_window_set_default_icon_from_file (const gchar *filename,
+                                      GError     **err)
+{
+  gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, err);
+  gboolean retval;
+
+  if (utf8_filename == NULL)
+    return FALSE;
+
+  retval = gtk_window_set_default_icon_from_file_utf8 (utf8_filename, err);
+
+  g_free (utf8_filename);
+
+  return retval;
+}
+
+#endif
index a52d675c0aa11039423e7a5b6e07fc87b0f4a082..54d1388bde56417683688d778fd6e341b76f0417 100644 (file)
@@ -164,6 +164,12 @@ struct _GtkWindowGroupClass
   void (*_gtk_reserved4) (void);
 };
 
+#ifdef G_OS_WIN32
+/* Reserve old names for DLL ABI backward compatibility */
+#define gtk_window_set_icon_from_file gtk_window_set_icon_from_file_utf8
+#define gtk_window_set_default_icon_from_file gtk_window_set_default_icon_from_file_utf8
+#endif
+
 GType      gtk_window_get_type                 (void) G_GNUC_CONST;
 GtkWidget* gtk_window_new                      (GtkWindowType        type);
 void       gtk_window_set_title                (GtkWindow           *window,
index 4bf31ec656e705e465ad6dcadbfc132f1078a477..5231a064b61cea39751fbc565e37ea07f388e60f 100644 (file)
@@ -27,6 +27,7 @@
 #include <utime.h>
 
 #include <glib.h>
+#include <glib/gstdio.h>
 
 #define CACHE_NAME "icon-theme.cache"
 
@@ -49,7 +50,7 @@ is_cache_up_to_date (const gchar *path)
   gchar *cache_path;
   int retval;
   
-  retval = stat (path, &path_stat);
+  retval = g_stat (path, &path_stat);
 
   if (retval < 0)
     {
@@ -59,7 +60,7 @@ is_cache_up_to_date (const gchar *path)
     }
 
   cache_path = g_build_filename (path, CACHE_NAME, NULL);
-  retval = stat (cache_path, &cache_stat);
+  retval = g_stat (cache_path, &cache_stat);
   g_free (cache_path);
   
   if (retval < 0 && errno == ENOENT)
@@ -554,7 +555,7 @@ build_cache (const gchar *path)
   GList *directories = NULL;
   
   tmp_cache_path = g_build_filename (path, "."CACHE_NAME, NULL);
-  cache = fopen (tmp_cache_path, "w");
+  cache = g_fopen (tmp_cache_path, "wb");
   
   if (!cache)
     {
@@ -571,7 +572,7 @@ build_cache (const gchar *path)
       /* Empty table, just close and remove the file */
 
       fclose (cache);
-      unlink (tmp_cache_path);
+      g_unlink (tmp_cache_path);
       exit (0);
     }
     
@@ -584,22 +585,22 @@ build_cache (const gchar *path)
   
   if (!retval)
     {
-      unlink (tmp_cache_path);
+      g_unlink (tmp_cache_path);
       exit (1);
     }
 
   cache_path = g_build_filename (path, CACHE_NAME, NULL);
 
-  if (rename (tmp_cache_path, cache_path) == -1)
+  if (g_rename (tmp_cache_path, cache_path) == -1)
     {
-      unlink (tmp_cache_path);
+      g_unlink (tmp_cache_path);
       exit (1);
     }
 
   /* Update time */
   /* FIXME: What do do if an error occurs here? */
-  stat (path, &path_stat);
-  stat (cache_path, &cache_stat);
+  g_stat (path, &path_stat);
+  g_stat (cache_path, &cache_stat);
 
   utime_buf.actime = path_stat.st_atime;
   utime_buf.modtime = cache_stat.st_mtime;
@@ -621,12 +622,18 @@ main (int argc, char **argv)
   gchar *path;
   GOptionContext *context;
 
+  if (argc < 2)
+    return 0;
+
   context = g_option_context_new ("ICONPATH");
   g_option_context_add_main_entries (context, args, NULL);
 
   g_option_context_parse (context, &argc, &argv, NULL);
   
   path = argv[1];
+#ifdef G_OS_WIN32
+  path = g_locale_to_utf8 (path, -1, NULL, NULL, NULL);
+#endif
   
   if (!force_update && is_cache_up_to_date (path))
     return 0;
index b50f7107cb6a9c3e6660310481190621911aab3e..8b690f99363c42651b86d38756563e4326a15e8f 100644 (file)
@@ -1,4 +1,4 @@
-themedir = $(datadir)/themes/gtk-2.0
+themedir = $(datadir)/themes/MS-Windows/gtk-2.0
 theme_DATA=gtkrc
 
 EXTRA_DIST=$(theme_DATA)